<div class="cart list">
    <h1>Корзина</h1>

    <?php
    if($oRowset)
    {
    ?>
    <form action="" method="post">
        <table>
            <tr>
                <th class="img">Товар</th>
                <th class="title"></th>
                <th class="price">Цена</th>
                <th class="quantity">Количество</th>
                <th class="sum">Сума</th>
            </tr>

            <?php
            $total = 0;
            $totalOld = 0;
            $totalUsd = 0;
            $totalOldUsd = 0;
            foreach($oRowset as $oRow)
            {
	            if(empty($oOrderGoods[$oRow->id]))
		            continue;

	            $aProperties = $oOrderGoods[$oRow->id]->getProperties();
            ?>
                <tr>
                    <td class="img"><?php
                        if(!empty($oRow['photo']))
                        {
                        ?><a href="<?php echo $this->createUrl('/goods/default/view/', array('id' => $oRow->alias, 'category' => $oRow->category_alias)); ?>"><img alt="" src="<?php echo $oRow['photo']['path'] .'list-'. $oRow['photo']['file']; ?>" /></a><?php
                        }
                    ?></td>
                    <td class="title">
	                    <a href="<?php echo $this->createUrl('/goods/default/view/', array('id' => $oRow->alias, 'category' => $oRow->category_alias)); ?>"><?php echo $oRow->title; ?></a>
	                    <?php if(!empty($oRow->property)): //!empty($oGoodsRow[$oRow->id]) &&
//		                    print_r($oOrderGoods[$oRow->id]); exit;
		                    ?>
	                    <div class="info">
	                    <?php
	                    foreach($oRow->property as $pId => $oPropertyRowset):
		                    foreach($oPropertyRowset as $oProperty):
			                    if($pId == '3' && !empty($aProperties['size']) && $aProperties['size'] != $oProperty['value_id'])
				                    continue;
	                    ?>
		                    <p><span><?php echo $oProperty['title']; ?>:</span>&nbsp;<span><?php echo $oProperty['value']; ?></span></p>
	                    <?php
		                    endforeach;
	                    endforeach;
	                    ?>

	                    </div>
	                    <?php endif; ?>
                    </td>
                    <td class="price">
	                    <span><?php echo Currencies::convert($oRow->price); ?></span>
	                    <?php if($oRow->old_price > 0 && $oRow->price > 0): ?>
	                    <p class="was"><span><?php echo Currencies::convert($oRow->old_price); ?></span> <span>скидка <?php
		                    $was = 100 - round($oRow->price / $oRow->old_price * 100);
		                    $totalOld += Currencies::convert($oRow->old_price, 'USD', false) * Order::model()->getCountInCart($oRow->id);
		                    $totalOldUsd += $oRow->old_price * Order::model()->getCountInCart($oRow->id);
		                    echo $was;
	                    ?>%</span></p>
	                    <?php endif; ?>
                    </td>
                    <td class="quantity">
	                    <input type="number" name="quantity[<?php echo $oRow->id; ?>]" value="<?php echo Order::model()->getCountInCart($oRow->id); ?>" /><br />
	                    <a href="<?php echo $this->createUrl('/goods/cart/remove', array('id' => $oRow->id)); ?>">удалить</a>
                    </td>
                    <td class="sum"><?php
	                    $totalUsd += $oRow->price * Order::model()->getCountInCart($oRow->id);
                        $total += Currencies::convert($oRow->price, 'USD', false) * Order::model()->getCountInCart($oRow->id);
                        echo Currencies::convert($oRow->price, 'USD', false) * Order::model()->getCountInCart($oRow->id) . ' грн';
                    ?></td>
                </tr>
            <?php
            }
            ?>
        </table>

        <div class="total">
	        <div class="table">
		        <p class="sum">Сума за <?php echo Order::model()->getCountInCart(); echo ' '. String::declination(Order::model()->getCountInCart(), array('товар', 'товара', 'товаров')) ?>: &nbsp;<span><?php echo $total .' грн'; ?></span></p>
		        <p class="delivery">Доставка куръером: &nbsp;<span><?php echo Currencies::convert(10); $total += Currencies::convert(10, 'USD', false); ?></span></p>
	            <p class="total-sum">Общая сума: &nbsp;<span><?php echo $total .' грн'; ?></span></p>
	        </div>
			<?php if($totalUsd > 0 && $totalOldUsd > 0): ?>
	        <p class="was"><span><?php echo $totalOld; ?> грн</span> <span>скидка <?php echo 100 - round($totalUsd / $totalOldUsd * 100); ?>%</span></p>
			<?php endif; ?>
        </div>
	    <div class="clear"></div>

        <div class="form">
            <h2>Оформление заказа</h2>

            <div class="item">
                <label>Имя</label>
                <input type="text" name="name" required="" />
            </div>
            <div class="item">
                <label>Телефон</label>
                <input type="text" name="phone" required="" />
            </div>
            <div class="item">
                <label>Адрес</label>
                <input type="text" name="address" required="" />
            </div>
            <div class="item">
                <label>Комментарий</label>
                <textarea name="comment"></textarea>
            </div>
            <div class="item иет">
                <label></label>
                <button type="submit" name="order"><span>Заказать</span></button>
            </div>
        </div>

    </form>
    <?php
    }
    else
    {
    ?>
    <div class="no-result">В корзине нет товаров</div>
    <?php } ?>



</div>